﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SheepStorage.API.Application.Command.EarTagCommand;
using SheepStorage.API.Application.Command.SheepMarkCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Domain.DTO.Output;
using SheepStorage.Domain.Entity;

namespace SheepStorage.API.Controllers
{
    /// <summary>
    /// 羊只戴标
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SheepMarkController : ControllerBase
    {
        private readonly IMediator _mediator;
        public SheepMarkController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        /// 戴标列表
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<Domain.DTO.Output.PageOutput<SheepMark>>> GetSheepMarks(SheepMarkSelectCommand command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 戴标添加
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<int>> AddSheepMarks(SheepMarkAddCommand command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 戴标单删
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<int>> DelSheepMarks(SheepMarkDeleteCommand command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 戴标批量删
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<int>> BatchDelSheepMarks(SheepMarkBatchDelCommand command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 戴标反填
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<SheepMark>> GetSheepMark(SheepMarkEditCommand command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 戴标修改
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<int>> UpdSheepMarks(SheepMarkUpdateCommand command)
        {
            return await _mediator.Send(command);
        }

    }
}
